package behavioral.iterator;

import java.util.List;

/**
 * @Description: 员工迭代器
 * @Author: lxt
 * @CreateDate: 2019/11/1
 **/
public class EmployeeIterator implements IIterator {
    private List<Employee> list;
    int index = 0;

    public EmployeeIterator(List<Employee> list) {
        this.list = list;
    }

    public boolean hasNext() {
        return list.size() > index;
    }

    public Employee next() {
        return list.get(index++);
    }
}
